package com.uhylab.uhuvinetest.base;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by xyb on 15/12/4 at UHylab
 *
 * @version 1.0
 */
public abstract class UHBaseFragment extends Fragment {
    public View view;
    protected Context mActivity;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mActivity = getActivity();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        view = inflaterView(inflater, container);
        initView();
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
//        mActivity = getActivity();
        initData();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();

    }



    @Override
    public void onDestroy() {
        super.onDestroy();
        initDestrory();
    }

    // 设置布局数据
    public abstract void initData();

    // 设置shanchu
    protected abstract void initDestrory();

    // 初始化布局
    protected abstract void initView();

    // 加载布局
    protected abstract View inflaterView(LayoutInflater inflater, ViewGroup container);
}
